<script type="text/javascript">
	$(document).ready(function(){
		var userinfo = Utils.getCookie("userinfo");
		//头部赋值
		var obj_shop = new Object();
        obj_shop = $.parseJSON(shop_json);
        var obj_clothes = new Object();
        obj_clothes = $.parseJSON(clothes_json);

        var shopHtml = '';
        $.each(obj_shop, function(sex, obj_label){
           shopHtml += "<ul id='shop_"+sex+"'>";
           $.each(obj_label, function(key, label){
               var clothes_data = obj_clothes[label];
               shopHtml += '<li>';
               shopHtml += '<div class="posfloatl"><img width="70px" height="70px" src="./img/style/'+clothes_data.pic_url+'"></div>';
               shopHtml += '<div>';
               shopHtml += '<div class="posfloatl">';
               shopHtml += '<div style="padding-right:20px;">'+clothes_data.name+'</div>';
               shopHtml += '<div>'+clothes_data.price+'</div>';
               shopHtml += '<div><a onclick="shopBuy(\''+label+'\');return false;">'+LNG.BUY+'</a></div>';
               shopHtml += '</div>';
               shopHtml += '<div class="posclear">'+get_clothes_attr(clothes_data.intelligence, clothes_data.strength)+'</div>';
               shopHtml += '</div>';
               shopHtml += "</li>";
           });
            shopHtml += "</ul>";
        });
        $("#scroller").html(shopHtml);
        $("#shop_2").hide();
        loaded();
        $("#clothes_shop_nav nav").click(function(){
            var sex_pos = $(this).index();
            $("#scroller ul").hide();
            $("#shop_"+sex_pos).show();
        });
	});
    var myScroll;
    function loaded() {
        myScroll = new iScroll('clothes_shop', {hScrollbar:false, vScrollbar:false});
    }
    //buy a clothes
    function shop_buy(label) {
        var args = new Object();
        args.label = label;
		ajax_call('shop', 'buy', args, success_get_kid);
    }
    function success_get_kid(ret) {
        $('#header_coin').html(ret.coin);
        $('#header_cash').html(ret.cash);
        alert(LNG.BUY_SUCCESS);
    }
</script>
<div style="padding-top: 25px;">
    <div id='clothes_shop_nav'>
        <nav>不限</nav>
        <nav>男</nav>
        <nav>女</nav>
    </div>
    <div id="clothes_shop">
        <div id='scroller'></div>
    </div>
</div>
